package com.hpdz.hotel_back.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hpdz.hotel_back.entity.Employee;
import com.hpdz.hotel_back.mapper.EmployeeMapper;
import com.hpdz.hotel_back.service.EmployeeService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
@Transactional
@Service
public class EmployeeServiceImpl extends ServiceImpl<EmployeeMapper, Employee> implements EmployeeService {

    @Resource
    private EmployeeMapper employeeMapper;

    @Override
    public Employee login(Employee emp) {
        QueryWrapper<Employee> wrapper = new QueryWrapper<>();
        wrapper.eq(true,"email",emp.getEmail());
        wrapper.eq(true,"passwd",emp.getPassword());

        return  employeeMapper.selectOne(wrapper);
    }
}
